﻿@{
    Layout = "~/Views/Shared/_FormWhite.cshtml";
}
@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment HostingEnvironment
@section header{
    <link href="@Url.Content("~/lib/summernote/0.8.15/summernote.min.css")" rel="stylesheet" type="text/css">
    <script src='@Url.Content("~/lib/summernote/0.8.15/summernote.js")' type="text/javascript"></script>
    <script src='@Url.Content("~/lib/summernote/0.8.15/lang/summernote-zh-CN.min.js")' type="text/javascript"></script>

    @BundlerHelper.Render(HostingEnvironment.ContentRootPath, Url.Content("~/lib/imageupload/1.0/css/imgup.min.css"))
    @BundlerHelper.Render(HostingEnvironment.ContentRootPath, Url.Content("~/lib/imageupload/1.0/js/imgup.min.js"))

    @BundlerHelper.Render(HostingEnvironment.ContentRootPath, Url.Content("~/lib/bootstrap.tagsinput/0.8.0/bootstrap-tagsinput.min.css"))
    @BundlerHelper.Render(HostingEnvironment.ContentRootPath, Url.Content("~/lib/bootstrap.tagsinput/0.8.0/bootstrap-tagsinput.min.js"))
}
<div class="wrapper animated fadeInRight">
    <form id="form" class="form-horizontal m">
        <div class="form-group">
            <label class="col-sm-2 control-label ">网站标题<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="myTitle" col="MyTitle" type="text" class="form-control" />
            </div>

            <label class="col-sm-2 control-label ">公司地址<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="myAddress" col="MyAddress" type="text" class="form-control" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label ">邮箱<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="myEmail" col="MyEmail" type="text" class="form-control" />
            </div>
            <label class="col-sm-2 control-label ">网站负责人<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="myName" col="MyName" type="text" class="form-control" />
            </div>

        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label ">关键字<font class="red"> *</font></label>
            <div class="col-sm-10">
                <input id="myGuanjianzi" col="MyGuanjianzi" type="text" class="form-control" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label ">备案号<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="myBeian" col="MyBeian" type="text" class="form-control" />
            </div>
            <label class="col-sm-2 control-label ">技术支持<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="myJishu" col="MyJishu" type="text" class="form-control" />
            </div>
        </div>
        @*<div class="form-group">
            <label class="col-sm-2 control-label ">邮编<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="myYoubian" col="MyYoubian" type="text" class="form-control" />
            </div>
            <label class="col-sm-2 control-label ">头像<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="myImage" col="MyImage" type="text" class="form-control" />
            </div>
        </div>*@
        <div class="form-group">
            <label class="col-sm-2 control-label ">400电话<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="myTel" col="MyTel" type="text" class="form-control" />
            </div>
            <label class="col-sm-2 control-label ">版权信息<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="myBanquan" col="MyBanquan" type="text" class="form-control" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label ">服务商数<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="myFuwushang" col="MyFuwushang" type="text" class="form-control" />
            </div>
            <label class="col-sm-2 control-label ">网点数<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="myWangdian" col="MyWangdian" type="text" class="form-control" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label ">访问数<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="myFangwen" col="MyFangwen" type="text" class="form-control" />
            </div>
            <label class="col-sm-2 control-label ">用户数<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="myUsers" col="MyUsers" type="text" class="form-control" />
            </div>
        </div>

        @*<div class="form-group">
            <label class="col-sm-2 control-label ">图片2<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="myImages2" col="MyImages2" type="text" class="form-control" />
            </div>
            <label class="col-sm-2 control-label ">MyT1<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="myT1" col="MyT1" type="text" class="form-control" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label ">MyT3<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="myT3" col="MyT3" type="text" class="form-control" />
            </div>
            <label class="col-sm-2 control-label ">MyT5<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="myT5" col="MyT5" type="text" class="form-control" />
            </div>
        </div>*@
        <div class="form-group">
            <label class="col-sm-2 control-label ">
                <span>二维码</span>
            </label>
            <div class="col-sm-4">
                <div id="myErweima" class="img-box"></div>
            </div>
            <label class="col-sm-2 control-label ">小程序<font class="red"> *</font></label>
            <div class="col-sm-4">

                <div id="myXiaochengxu" class="img-box"></div>
            </div>
            @*<label class="col-sm-2 control-label ">公众号</label>
            <div class="col-sm-4">

                <div id="myGzh" class="img-box"></div>
            </div>*@
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label ">域名<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="myYuming" col="MyYuming" type="text" class="form-control" />
            </div>
            <label class="col-sm-2 control-label ">天猫地址<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="myTmall" col="MyTmall" type="text" class="form-control" />
            </div>

        </div>
        <div class="form-group">

            <label class="col-sm-2 control-label ">描述<font class="red"> *</font></label>
            <div class="col-sm-10">
                <input id="myMiaoshu" col="MyMiaoshu" type="text" class="form-control" />
            </div>
        </div>
        @*<div class="form-group">
                <label class="col-sm-2 control-label ">电话<font class="red"> *</font></label>
                 <div class="col-sm-4">
                     <input id="myPhont" col="MyPhont" type="text" class="form-control" />
                 </div>

        </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label ">传真<font class="red"> *</font></label>
                    <div class="col-sm-4">
                        <input id="myFax" col="MyFax" type="text" class="form-control" />
                    </div>
                    <label class="col-sm-2 control-label ">logo<font class="red"> *</font></label>
                    <div class="col-sm-4">
                        <input id="myLogo" col="MyLogo" type="text" class="form-control" />
                    </div>
                </div>*@


        <div class="form-group">
            <label class="col-sm-2 control-label ">网站介绍<font class="red"> *</font></label>
            <div class="col-sm-10">
                <textarea id="myContent" col="MyContent" class="form-control"></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label ">网点内容<font class="red"> *</font></label>
            <div class="col-sm-10">
                <textarea id="myWangdiancontent" col="MyWangdiancontent" class="form-control"></textarea>

            </div>
        </div>
        @*<div class="form-group">
                <label class="col-sm-2 control-label ">MyImages1<font class="red"> *</font></label>
                <div class="col-sm-4">
                    <input id="myImages1" col="MyImages1" type="text" class="form-control" />
                </div>
                <label class="col-sm-2 control-label ">MyImages3<font class="red"> *</font></label>
                <div class="col-sm-4">
                    <input id="myImages3" col="MyImages3" type="text" class="form-control" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label ">MyT2<font class="red"> *</font></label>
                <div class="col-sm-4">
                    <input id="myT2" col="MyT2" type="text" class="form-control" />
                </div>
                <label class="col-sm-2 control-label ">MyT4<font class="red"> *</font></label>
                <div class="col-sm-4">
                    <input id="myT4" col="MyT4" type="text" class="form-control" />
                </div>
            </div>
        <div class="form-group">
           <label class="col-sm-2 control-label ">MyT6<font class="red"> *</font></label>
                <div class="col-sm-4">
                    <input id="myT6" col="MyT6" type="text" class="form-control" />
                </div>
                    <label class="col-sm-2 control-label ">备注<font class="red"> *</font></label>
                <div class="col-sm-4">
                    <input id="myRemarks" col="MyRemarks" type="text" class="form-control" />
                </div>


            </div>
           <div class="form-group">
                <label class="col-sm-2 control-label ">网站地址<font class="red"> *</font></label>
                <div class="col-sm-4">
                    <input id="myUrl" col="MyUrl" type="text" class="form-control" />
                </div>
                <label class="col-sm-2 control-label ">背景图片<font class="red"> *</font></label>
                <div class="col-sm-4">
                    <input id="myBeijing" col="MyBeijing" type="text" class="form-control" />
                </div>
            </div>*@
    </form>
</div>

<script type="text/javascript">
    var id = ys.request("id");
    $(function () {
        $("#myErweima").imageUpload({ uploadImage: 'uploadThumbImage', limit: 1, context: ctx });
        $("#myGzh").imageUpload({ uploadImage: 'uploadThumbImage', limit: 1, context: ctx });
        $("#myXiaochengxu").imageUpload({ uploadImage: 'uploadThumbImage', limit: 1, context: ctx });
        getForm();

        $('#form').validate({
            rules: {
                myTitle: { required: true }
            }
        });
    });

    function getForm() {
        if (id > 0) {
            ys.ajax({
                url: '@Url.Content("~/OrganizationManage/My/GetFormJson")' + '?id=' + id,
                type: 'get',
                success: function (obj) {
                    if (obj.Tag == 1) {

                        $('#form').setWebControls(obj.Result);
                        $("#myErweima").imageUpload("setImageUrl", obj.Result.MyErweima);
                        $("#myGzh").imageUpload("setImageUrl", obj.Result.MyGzh);
                        $("#myXiaochengxu").imageUpload("setImageUrl", obj.Result.MyXiaochengxu);
                    }
                }
            });
        }
        else {
            var defaultData = {};
            $('#form').setWebControls(defaultData);
        }
    }

    function saveForm(index) {
        if ($('#form').validate().form()) {
            var postData = $('#form').getWebControls({ Id: id });
            postData.MyErweima = $("#myErweima").imageUpload("getImageUrl");
            postData.MyGzh = $("#myGzh").imageUpload("getImageUrl");
            postData.MyXiaochengxu = $("#myXiaochengxu").imageUpload("getImageUrl");
            ys.ajax({
                url: '@Url.Content("~/OrganizationManage/My/SaveFormJson")',
                type: 'post',
                data: postData,
                success: function (obj) {
                    if (obj.Tag == 1) {
                        ys.msgSuccess(obj.Message);
                        parent.searchGrid();
                        parent.layer.close(index);
                    }
                    else {
                        ys.msgError(obj.Message);
                    }
                }
            });
        }
    }
    function uploadThumbImage(file, callback) {
        var formdata = new FormData();
        formdata.append("fileList", file);
        ys.ajaxUploadFile({
            url: '@GlobalContext.SystemConfig.ApiSite' + '/File/UploadFile?fileModule=@UploadFileType.News.ParseToInt()',
            data: formdata,
            success: function (obj) {
                if (obj.Tag == 1) {
                    if (callback) {
                        callback('@GlobalContext.SystemConfig.ApiSite' + obj.Result);
                    }
                }
                else {
                    ys.msgError(obj.Message);
                }
            }
        })
    }
</script>

